/*
 * TITLE:DebuggerMenu
 * AUTHOR:Manori Thakur
 * PURPOSE: Displays the first screen with main menu and triggers Login, Help
 * and Facebook share
 */
package com.example.android.debuggermenu;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.content.Intent;
import android.widget.TextView;

public class DebuggerMenu extends DebuggerActivity {
	private static final String TAG = DebuggerMenu.class.getSimpleName();
    private Menu myMenu=null;
    private TextView tv=null;
    private Intent item1Intent=null,item2Intent=null,item3Intent=null;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.menu_layout);
        tv=(TextView)this.findViewById(R.id.textViewId);

    }

    /**Creates the options when menu is clicked**/
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);

        this.myMenu=menu;
        MenuItem item1,item2,item3;
        int base=Menu.FIRST;

        item1=menu.add(base,base,base,"Play Game");
        item1Intent=new Intent(this, Login.class);
        item1.setIntent(item1Intent);

        item2=menu.add(base,base+1,base+1,"Help");
        item2Intent=new Intent(this,DebuggerHelp.class);
        item2.setIntent(item2Intent);

        item3=menu.add(base,base+2,base+2,"Share");
        item3.setIcon(R.drawable.facebook_icon);
        item3Intent=new Intent(this,LogFacebook.class);
        item3.setIntent(item3Intent);

        //emptyText();

        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        //tv.setEnabled(true);
        if(item.getItemId()==1){
            startActivity(item1Intent);
        }
        else if(item.getItemId()==2) {
            startActivity(item2Intent);
        }
        else if(item.getItemId()==3) {
            startActivity(item3Intent);
        }

        return true;

    }

    /** Clears the text 'Click Menu for options' **/
    private void emptyText() {
        tv.setText("");
    }

}
